package behavioral.templateMethod.java;

public class Person implements Comparable<Person> {
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    private String name;
    private int height;

    public Person(String name, int height) {
        this.name = name;
        this.height = height;
    }

    @Override
    public int compareTo(Person otherPerson) {
        if (this.height < otherPerson.height) {
            return -1;
        } else if (this.height > otherPerson.height) {
            return 1;
        } else {
            return 0;
        }
    }
}
